package com.itheima.d5_Api_Arrays;

import java.util.Arrays;

/**
 * Api:toString sort binarySearch
 */
public class demo1 {
    public static void main(String[] args) {
        int[] a = new int[]{100,22,3,45};
        //1.toString
        System.out.println(Arrays.toString(a));

        //2.sort(默认升序)
        Arrays.sort(a);
        System.out.println(a.toString());

        //3.二分搜索(必须是有序的数组)
        int index = Arrays.binarySearch(a,22);
        System.out.println(index);

        //返回不存在元素的规律------  -（应该插入的位置+1）
        int index1 = Arrays.binarySearch(a,1000);
        System.out.println(index1);

    }
}
